Skip to content

Surface hidden counts for TopFiles and Collaborators in DevProfile#9

Merged
lex0c merged 2 commits intomainfrom
fix/profile-hidden-topfiles-collab
Apr 20, 2026
Merged

Surface hidden counts for TopFiles and Collaborators in DevProfile#9
lex0c merged 2 commits intomainfrom
fix/profile-hidden-topfiles-collab

Conversation

@lex0c
Copy link
Copy Markdown
Owner

@lex0c lex0c commented Apr 20, 2026

Completes the hidden-counter family started with Scope/Extensions. TopFiles truncates at 10 and Collaborators at 5; both used to drop buckets silently. A dev with 25 touched files or 12 frequent collaborators looked like they had exactly 10/5 — reader had no way to tell "this is the whole footprint" apart from "this is a sample of a larger set". The k8s-release-robot profile is a good example: 62 distinct collaborators and 18 top files, previously collapsed to the displayed top-N without trace.

Add TopFilesHidden and CollaboratorsHidden fields on DevProfile; populate at the truncation sites. Render in three surfaces matching the established pattern:

  • CLI PrintProfiles: inline "(+N more)" on the Collaboration line,
    standalone " ... (+N more files not shown)" after Top files.
  • HTML main report profile card: italic span on Collaboration,
    italic div below Top files.
  • HTML dedicated profile: italic chip after Collaborators,
    colspan-4 row at the bottom of the Top Files table.

Silent when Hidden == 0 (the common case) so reports of tight teams don't gain noise.

Tests: TestDevProfileHiddenCountersTopFilesAndCollaborators constructs a dev with 18 authored files and 6 collaborators, asserts TopFilesHidden=8 and CollaboratorsHidden=1. TestDevProfileHiddenCountersZeroWhenFits extended to pin both new counters to 0 in the no-truncation case.

Verified on kubernetes/k8s-release-robot: CLI shows "(+57 more)" on Collaboration and "(+8 more files not shown)" at bottom of Top files; HTML dedicated profile shows both markers.

Completes the hidden-counter family started with Scope/Extensions.
TopFiles truncates at 10 and Collaborators at 5; both used to drop
buckets silently. A dev with 25 touched files or 12 frequent
collaborators looked like they had exactly 10/5 — reader had no way
to tell "this is the whole footprint" apart from "this is a sample
of a larger set". The k8s-release-robot profile is a good example:
62 distinct collaborators and 18 top files, previously collapsed to
the displayed top-N without trace.

Add TopFilesHidden and CollaboratorsHidden fields on DevProfile;
populate at the truncation sites. Render in three surfaces matching
the established pattern:
- CLI PrintProfiles: inline "(+N more)" on the Collaboration line,
  standalone "    ... (+N more files not shown)" after Top files.
- HTML main report profile card: italic span on Collaboration,
  italic div below Top files.
- HTML dedicated profile: italic chip after Collaborators,
  colspan-4 row at the bottom of the Top Files table.

Silent when Hidden == 0 (the common case) so reports of tight teams
don't gain noise.

Tests: TestDevProfileHiddenCountersTopFilesAndCollaborators
constructs a dev with 18 authored files and 6 collaborators,
asserts TopFilesHidden=8 and CollaboratorsHidden=1.
TestDevProfileHiddenCountersZeroWhenFits extended to pin both new
counters to 0 in the no-truncation case.

Verified on kubernetes/k8s-release-robot: CLI shows "(+57 more)" on
Collaboration and "(+8 more files not shown)" at bottom of Top
files; HTML dedicated profile shows both markers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lex0c
Copy link
Copy Markdown
Owner Author

lex0c commented Apr 20, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sibling to the profile hidden counters from the previous commit, but
different pattern: top-level tables in the HTML report now show their
universe size inline in the h2 (e.g. "Top Contributors 20 of 5,295")
when truncation is in effect. Silent when the displayed list is the
whole set.

Rationale vs "+N more" rows at table bottoms: user passed --top N
explicitly, so they know truncation happened — the useful signal is
*how big is the repo*, not *was something hidden*. 5,295 devs vs 40
devs is diagnostic information the reader wants at a glance.
Bottom-of-table "+N more" would also compound across 7 tables
visually. Header badge: one line per section, no reading weight
added.

Applied to 7 tables where the denominator is well-defined (stat's
output universe matches a clean total):
  Contributors    — Summary.TotalDevs
  File Hotspots   — Summary.TotalFiles
  Directories     — ReportData.TotalDirectories (new)
  Extensions      — ReportData.TotalExtensions (new)
  Churn Risk      — Summary.TotalFiles
  Bus Factor Risk — ReportData.TotalBusFactorFiles (new; see below)
  Top Commits     — Summary.TotalCommits
Skipped Coupling and Dev Network because --coupling-min-changes and
--network-min-files filter before ranking, so "total pairs" isn't a
clean denominator.

BusFactor's universe isn't TotalFiles. The stat skips files where
fe.devLines is empty (pure-rename-only files after the earlier
ingest fix). Using Summary.TotalFiles as the denominator would lie
on rename-heavy repos: kubernetes has 76,538 files but only 71,510
(93.4%) carry authored lines — a 5,028-file gap. Added
BusFactorCount that excludes empty-devLines files and use it
instead. DirectoryCount / ExtensionCount similarly dedicated to
keep the helper lightweight (DirectoryStats with n=0 does expensive
per-dir bus factor sorts we don't need just to count).

Tests: TestDirectoryCountAndExtensionCount pins the counts on a
small fixture AND asserts the invariant
`Count == len(stat(ds, 0))`, so any future drift in derivation
surfaces in CI. TestBusFactorCountExcludesEmptyDevLines covers the
pure-rename skip specifically.

Smoke: pi-hole shows "20 of 207" (8 pure-rename files excluded),
kubernetes "20 of 71,510" (5,028 excluded).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lex0c
Copy link
Copy Markdown
Owner Author

lex0c commented Apr 20, 2026

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lex0c lex0c merged commit d64fa4f into main Apr 20, 2026
4 checks passed
@lex0c lex0c deleted the fix/profile-hidden-topfiles-collab branch April 20, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant